package com.zhika.zishi.activity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ListView;

import com.zhika.zishi.R;
import com.zhika.zishi.adapter.CompareShowAdapter;
import com.zhika.zishi.beans.CompareShowBean;
import com.zhika.zishi.customview.TitleView;
import com.zhika.zishi.interfaces.TitleInterface;

import java.util.ArrayList;

/**
 * Created by shi-02 on 2015/4/10.
 */
public class CompareShowActivity extends BaseActivity implements TitleInterface{

    private ListView listView;

    private ArrayList<CompareShowBean> compareShowList = new ArrayList<>();

    private CompareShowAdapter adapter;

    private TitleView titleView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.compare_show_layout);

        addTestData();

        initView();
    }

    private void initView(){
        listView = (ListView) findViewById(R.id.compare_show_list_view);
        adapter = new CompareShowAdapter(this,compareShowList);
        listView.setAdapter(adapter);

        titleView = (TitleView) findViewById(R.id.compare_show_title_view);
        titleView.setTitleViewInterface(this);
        titleView.setMiddleRowText("对比秀");
        titleView.setLeftButtonText("返回");
        titleView.setRightButtonText("相机");
    }

    /**
     * 测试数据
     */
    private void addTestData(){
        for (int i=0;i<10;i++){
            CompareShowBean bean = new CompareShowBean();
            bean.setNickname("攻略者昵称");
            bean.setFeelStr("哈哈哈哈哈哈哈，感受啊");
            bean.setLikeNumStr("111");
            bean.setDislikeNumStr("10");

            compareShowList.add(bean);
        }
    }

    @Override
    public void leftTitleListener() {
        finish();
    }

    @Override
    public void middleTitleListener() {

    }

    @Override
    public void rightTitleListener() {
        Intent intent = new Intent(CompareShowActivity.this,NewCompareActivity.class);
        startActivity(intent);
    }
}
